package GUI;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class OfferTime extends JPanel implements ActionListener {
	private Controller control;
	private JComboBox theBox;
	public OfferTime(Controller c)
	{
		this.control = c;
		String[] index = {"1", "2", "3", "4", "5", "6", "7"};  
		theBox = new JComboBox(index);
		theBox.addActionListener(this);
		theBox.setSelectedIndex(control.getdefaultSelect());
		
		
		JLabel timeLabel = new JLabel("Offer Time: ");
		JPanel panel = new JPanel(new GridLayout(1, 2));
		panel.add(timeLabel);
		panel.add(theBox);
		add(panel, BorderLayout.LINE_START);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		control.setOfferTime(Integer.valueOf(theBox.getSelectedItem().
                        toString()));
	}
}
